<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
  
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  
  <head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>新增订单</title>
		
		
<!-- BOOTSTRAP STYLES-->
    <link href="assets/css/bootstrap.css" rel="stylesheet" />
     <!-- FONTAWESOME STYLES-->
    <link href="assets/css/font-awesome.css" rel="stylesheet" />
     <!-- MORRIS CHART STYLES-->
    <link href="assets/js/morris/morris-0.4.3.min.css" rel="stylesheet" />
        <!-- CUSTOM STYLES-->
    <link href="assets/css/custom.css" rel="stylesheet" />
     <!-- GOOGLE FONTS-->
   <link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css' />
   
   
    <!-- /. WRAPPER  -->
    <!-- SCRIPTS -AT THE BOTOM TO REDUCE THE LOAD TIME-->
    <!-- JQUERY SCRIPTS -->
    <script src="assets/js/jquery-1.10.2.js"></script>
      <!-- BOOTSTRAP SCRIPTS -->
    <script src="assets/js/bootstrap.min.js"></script>
    <!-- METISMENU SCRIPTS -->
    <script src="assets/js/jquery.metisMenu.js"></script>
     <!-- MORRIS CHART SCRIPTS -->
     <script src="assets/js/morris/raphael-2.1.0.min.js"></script>
    <script src="assets/js/morris/morris.js"></script>
      <!-- CUSTOM SCRIPTS -->
    <script src="assets/js/custom.js"></script>
    
    
    
		
		
		<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
		<script type="text/javascript" src="http://lib.sinaapp.com/js/jquery/2.0.3/jquery-2.0.3.min.js"></script>
		<script src="js/order.js"></script><script src="js/time.js"></script>
		
  </head>
  
  <body>
             
     <div id="wrapper">
        <nav class="navbar navbar-default navbar-cls-top " role="navigation" style="margin-bottom: 0">
            <div class="navbar-header">
               
                <a class="navbar-brand" href="jsp/index.jsp">首页</a> 
            </div>
  <div style="color: white;
			padding: 15px 50px 5px 50px;
			float: right;
			font-size: 16px;"> <span id="Clock"></span>欢迎<%=session.getAttribute("me")%>
			&nbsp; <a href="invalidateServlet" class="btn btn-danger square-btn-adjust">Logout</a> </div>
        </nav>   
           <!-- /. NAV TOP  -->
           
        <!-- /. NAV SIDE  -->
        
            <div id="page-inner">
            
           <div class="container-fluid">
      <div class="row">
    	<h3 class="col-sm-offset-1" id="title">新增订单</h3><hr/>
      </div>
    	
      <div class="row">
        <div class="col-sm-3">
        </br></br></br>
        <button class="btn btn-primary btn-block" type="button" style="width:40%" onclick="newSale();">新一单</button>
        </br>
        
    	<div class="form-group">
    		<label for="productTypeId" class="col-sm-5 control-label">产品类型</label>
			    <div class="col-sm-7 input-group" style="padding:0px;">
			    	<select name="productTypeId" class="form-control" id="productTypeId" onchange="updateProduct();">
					</select>
			    </div>
    	</div>
    	
    	<div class="form-group">
    		<label for="product" class="col-sm-5 control-label">产品名称</label>
			    <div class="col-sm-7 input-group" style="padding:0px;">
			    	<select name="product" class="form-control" id="product">
					</select>
			    </div>
    	</div>
    	
    	<div class="form-group">
			    <label for="count" class="col-sm-5 control-label">产品数量</label>
			    <div class="col-sm-7" style="padding:0px;">
			      <input name="count" type="number" class="form-control" id="count">
			    </div>
		</div>
		<br><br><br>
	
			
		
		
		</br>
		<button class="btn btn-primary btn-block" type="button" style="width:40%" onclick="addProduct();">添加</button>
		<button class="btn btn-primary btn-block" type="button" style="width:40%" onclick="finishSale();">结账</button>
		
		
      </div>
      
      <div class="col-md-9">
        <table class="table table-striped table-hover" id="orders">
        	<tr><th>产品名称</th><th>单价(元)</th><th>数量</th><th>总价(元)</th></tr>
		</table>
		
		<h3 id="total"></h3>
       
		<div id="result_block" class="col-md-6 col-md-offset-3" style="display:none" >
	      <div class="panel panel-default">
		  	<div class="panel-body">
			  <center>
			  	<h2>XXX奶茶店</h2>
			  	<h5>地址：XXXX&nbsp;&nbsp;&nbsp;&nbsp;联系电话：88888888</h5>
			  	<h5 id="order_messge"></h5>
			  	<h5 id="sale_time"></h5>
			  	<table class="table" id="finish_table">
				</table>
			  </center>
			  <h5 id="result_total"></h5>
		    </div>
		  </div>
		  
		  <div class="row">
		  	<dir class="col-sm-12 text-center">
		  	<button type="button" class="btn btn-default" data-toggle="modal" data-target=".bs-example-modal-sm">确定</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		  		<button type="button" class="btn btn-default" onclick="newSale();">取消</button>
		  	</dir>
		  </div>
		  
	  		<div class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel">
			  <div class="modal-dialog modal-sm">
			    <div class="modal-content">
			      <div class="modal-header">
			        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
			        <h4 class="modal-title" id="myModalLabel">收款</h4>
			      </div>
			      <div class="modal-body">
			      	<form class="form-inline">
					  <div class="form-group">
					    <div class="input-group">
					      <div class="input-group-addon">应收：</div>
					      <input type="number" class="form-control" id="shouldPay" readonly>
					      <div class="input-group-addon">.00元</div>
					    </div>
					  </div><br/><br/>
					  <div class="form-group">
					    <div class="input-group">
					      <div class="input-group-addon">实收：</div>
					      <input type="number" class="form-control" id="actuallyPay" onkeyup="actuallyPayChange()">
					      <div class="input-group-addon">.00元</div>
					    </div>
					  </div><br/><br/>
					  <div class="form-group">
					    <div class="input-group">
					      <div class="input-group-addon">找零：</div>
					      <input type="number" class="form-control" id="surplus" readonly>
					      <div class="input-group-addon">.00元</div>
					    </div>
					  </div>
					</form>
			      </div>
			      <div class="modal-footer">
			        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
			        <button type="button" class="btn btn-primary" onclick="pay()">完成</button>
			      </div>
			    </div>
			  </div>
			</div>
		</div>
      </div>
      
      </div>
      
      
      	
    </div>
		
            </div>
             <!-- /. PAGE INNER  -->
            
         <!-- /. PAGE WRAPPER  -->
        </div>
    
    
    
    
    
  </body>


	<script type="text/javascript">
		var base = '<%=request.getAttribute("base")%>';
		$(function() {
			init();
		});
	</script>
</html>
